package com.liangtian.mdm.base.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ReadSystemParam {

    public final static String getValue(String key) throws IOException {
        InputStream in = ReadSystemParam.class.getClassLoader().getResourceAsStream("config.properties");
        Properties props = new Properties();
        try {
            props.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            in.close();
        }
        return props.getProperty(key);
    }

    public final static String getValue(String key, String fileName) throws IOException {
        InputStream in = ReadSystemParam.class.getClassLoader().getResourceAsStream(fileName);
        Properties props = new Properties();
        try {
            props.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            in.close();
        }
        return props.getProperty(key);
    }

    public static void main(String[] args) throws IOException {
        String s = ReadSystemParam.getValue("EXCLUDEDPATTERN");
        System.out.println(s);
    }
}
